﻿<UserControl x:Class="Mayhem.UserControls.ModuleView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             Loaded="UserControl_Loaded"
             >
    <UserControl.Resources>
        <Style x:Key="ConfigurationStringStyle" TargetType="{x:Type TextBlock}">
            <Setter Property="Control.FontSize" Value="12" />
            <Setter Property="Control.FontStyle" Value="Italic" />
            <Setter Property="Control.Foreground" Value="#1E2635" />
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect
                                      ShadowDepth="1"
                                      Direction="295"
                                      Color="LightGray"
                                      Opacity="0.5"
                                     BlurRadius="6"/>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="DisplayNameStyle" TargetType="{x:Type TextBlock}">
            <Setter Property="Control.FontSize" Value="16" />
            <Setter Property="Control.Foreground" Value="White" />
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect
                                      ShadowDepth="1"
                                      Direction="295"
                                      Color="Black"
                                      Opacity="0.5"
                                     BlurRadius="10"/>
                </Setter.Value>
            </Setter>
        </Style>
        <BooleanToVisibilityConverter x:Key="vizConverter"/>
        <Style x:Key="StyleModuleName">
            <Setter Property="Control.FontSize" Value="16" />
            <Setter Property="Control.Foreground" Value="White" />
        </Style>
        <Style TargetType="{x:Type Button}" BasedOn="{StaticResource EventButton}" x:Key="TriggerButton">
            <Setter Property="FontWeight" Value="Normal" />
            <Setter Property="FontSize" Value="16" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <ContentPresenter Content="{TemplateBinding Content}" Width="235" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type Button}" BasedOn="{StaticResource EventButton}" x:Key="ReactionButton">
            <Setter Property="FontWeight" Value="Normal" />
            <Setter Property="FontSize" Value="16" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <ContentPresenter Content="{TemplateBinding Content}" Width="235" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type Button}" BasedOn="{StaticResource EventButton}" x:Key="DeleteButton">
            <Setter Property="FontWeight" Value="Normal" />
            <Setter Property="FontSize" Value="16" />
            <Setter Property="Background">
                <Setter.Value>
                    <ImageBrush ImageSource="/Images/delete.png"/>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Rectangle Fill="{TemplateBinding Background}" />
                            <ContentPresenter Content="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,5" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <StackPanel>
        <StackPanel Orientation="Horizontal" >
            <StackPanel Orientation="Horizontal" Name="connectionButtons">
                <Button Name="buttonTrigger" Style="{StaticResource TriggerButton}" Width="235" Height="43" Margin="0,0,0,0" Focusable="False" Click="ConfigureTrigger_Click">
                    <Grid>
                        <Rectangle>
                            <Rectangle.Fill>
                                <ImageBrush ImageSource="/Images/redbutton_off.png"/>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle Name="redButtonImage">
                            <Rectangle.Fill>
                                <ImageBrush ImageSource="/Images/redbutton.png"/>
                            </Rectangle.Fill>
                        </Rectangle>
                    <Grid Width="220" Margin="0,0,0,-2" >
                        <TextBlock Name="textBlockEventNameDisabled" Style="{StaticResource DisplayNameStyle}" Foreground="#CCCCCC" Margin="5,-2,14,6" Text="{Binding EventName, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
                        <TextBlock Name="textBlockEventName" Style="{StaticResource DisplayNameStyle}" Margin="5,-2,14,6" Text="{Binding EventName, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
                        <Image x:Name="ImageSettingsEventOff" Width="16" Height="16" Margin="6,15,200,0" Source="/Mayhem;component/Images/off-settings.png" />
                        <Image x:Name="ImageSettingsEventRed" Width="16" Height="16" Margin="6,15,200,0" Source="/Mayhem;component/Images/red-settings.png" />
                        <TextBlock Style="{StaticResource ConfigurationStringStyle}" Margin="25,20,0,0" Text="{Binding EventConfigString, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
                    </Grid>
                    </Grid>

                </Button>
                <Button Name="buttonReaction" Style="{StaticResource ReactionButton}" Width="235" Height="43" Margin="0,0,0,0" Focusable="False" Click="ConfigureReaction_Click">
                    <Grid>
                        <Rectangle>
                            <Rectangle.Fill>
                                <ImageBrush ImageSource="/Images/bluebutton_off.png"/>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle Name="blueButtonImage">
                            <Rectangle.Fill>
                                <ImageBrush ImageSource="/Images/bluebutton.png"/>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Grid Width="220" Margin="25,0,0,-2" >
                            <TextBlock Name="textBlockReactionNameDisabled" Style="{StaticResource DisplayNameStyle}" Foreground="#CCCCCC" Margin="7,-2,14,6" Text="{Binding ReactionName, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
                            <TextBlock Name="textBlockReactionName" Style="{StaticResource DisplayNameStyle}" Margin="7,-2,14,6" Text="{Binding ReactionName, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
                            <Image x:Name="ImageSettingsReactionOff" Width="16" Height="16" Margin="6,15,200,0" Source="/Mayhem;component/Images/off-settings.png" />
                            <Image x:Name="ImageSettingsReactionBlue" Width="16" Height="16" Margin="6,15,200,0" Source="/Mayhem;component/Images/blue-settings.png" />
                            <TextBlock Style="{StaticResource ConfigurationStringStyle}" Margin="25,20,0,0" Text="{Binding ReactionConfigString, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
                        </Grid>
                    </Grid>
                </Button>
            </StackPanel>
            <ToggleButton Width="61" Height="42" Margin="15,0,0,0" Cursor="Hand" x:Name="OnOffButton" IsChecked="{Binding Path=IsEnabled, Mode=OneWay}" Click="OnOffClick" Focusable="False">
                <ToggleButton.Style>
                    <Style TargetType="{x:Type ToggleButton}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                    <Grid>
                                        <Image Source="/Images/off.png" />
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Style.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                                            <Grid>
                                                <Image Source="/Images/on.png" />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </ToggleButton.Style>
            </ToggleButton>
            <Button Margin="15,0,0,0" Width="24" Height="24" Tag="{Binding}" Cursor="Hand" Click="DeleteConnectionClick" Focusable="False"  Style="{StaticResource DeleteButton}" />
        </StackPanel>
    </StackPanel>
</UserControl>